<template>
  <router-link to="/test2">跳转到test2</router-link>
  <h1 style="background: #f00;min-height: 50px;" @click="config_map._count++">{{config_map._count}}</h1>
  <h1 style="background: #ff0;min-height: 50px;" >{{config_map.config?.page?.base?.seo_title}}</h1>

  <UnifyParam _type_="text_one" :model-value="text_one" @change="_log"></UnifyParam>
  <UnifyParam _type_="radio_switch" :model-value="text_one" @change="_log"></UnifyParam>

  <RequestTableSlot style="height: 400px" url="/admin/admin_log/list" :data="request_table.where" :cols="request_table.cols"  :default_order="request_table.order" limit="20">

  </RequestTableSlot>


</template>

<script>
import Forms from "@/components/forms.vue";
import UnifyParam from "@/components/auto_import/UnifyParam.vue";
import TableSlot from "@/components/slot/TableSlot.vue";
import RequestTableSlot from "@/components/slot/RequestTableSlot.vue";
import FormSlot from "@/components/slot/FormSlot.vue";

export default {
  components: {FormSlot, RequestTableSlot, TableSlot, UnifyParam, Forms},
  data() {
    return {
      alble: true,
      tab: 'page',
      obj: null,
      form_config: [],
      config_map: {
        name: {label:'用户名', name:'name', type:'text_one', tips:'用户名，登录用，不可修改'},
        password: {label:'密码',name:'password',type:'text_one',value:'',tips:'为空表示保持原密码'},
        nickname: {label:'昵称',name:'nickname',type:'text_one',value:'',tips:''},
        truename: {label:'真实姓名',name:'truename',type:'text_one',tips:''},
        head_img: {label:'头像',name:'head_img',type:'file_img',tips:'管理员头像，建议尺寸100*100'},
        admin_role_ids: {label:'角色',name:'admin_role_ids',type:'select_more',config:[],tips:''},
        phone: {label:'电话号码',name:'phone',type:'text_one',tips:'联系方式，手机号'},
        info: {label:'简介',name:'info',type:'text_more',tips:'简介、彰显个性和特点的一段话'},
        status: {label:'状态',name:'status',type:'radio_switch',config:["禁用","启用"],tips:'禁用的管理员无法登录'},
      },
      request_table: {
        where: {},
        order: 'id desc',
        cols: {
          id:{name:'id', label:'ID', width:'65px', fixed:'left', order:true},
          head_img: {name:'head_img', label:'头像', width:'45px', type:'file_img'},
          nickname: {name:'nickname', label:'管理员昵称', width: '120px'},
          path: {name:'path', label:'操作路径', min_width:'120px'},
          path_alias: {name:'path_alias', label:'操作内容', min_width:'120px'},
          http_status_code: {name:'http_status_code', label:'状态码', width:'60px'},
          ip: {name:'ip', label:'IP地址', width:'130px'},
        }
      },

      table_slot: {
        cols: [
          {label: '姓名', name:'name', type:'f', can_edit:true, onchange:this.list_change, order:true},
          {label: '标题', name:'title', can_edit:true, onchange:this.list_change, order:true}
        ],
        data: [
          {name: '123'}
        ]
      },

      text_one: '',
    }
  },
  computed: {
    show_forms(){
      return !!this.obj && this.alble;
    }
  },
  methods: {
    _log(e){
      console.log(e)
    },
    list_change(row, col, v, index){
      return new Promise(resolve => {
        setTimeout(()=>{
          resolve(false)
        }, 1500)
      })
    },
  },
  watch: {
    text_one(v, oldV){
      console.log(v, oldV)
    }
  },
  mounted() {
    setTimeout(()=>{
      this.obj = {a:1};
      this.form_config = [{name:'style', label:'样式', value:'', type:'text_one'}];
    },1000)
  }
}
</script>

<style>
.infinite-table {
  overflow: auto;
}

.loading-text, .no-more-text {
  text-align: center;
  padding: 10px;
  color: #999;
}
</style>